<?php

/**
 * GofishPlayer form.
 *
 * @package    gofish
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class GofishPlayerForm extends BaseGofishPlayerForm
{

  public function configure()
  {
      unset(
        $this['created_at'],
        $this['updated_at'],
        $this['points'],
        $this['girls'],
        $this['group_id']
          );
          
    $c = new sfCultureInfo(sfContext::getInstance()->getUser()->getCulture());
    $countries = $c->getCountries();
    
    $ageArray = array(18 => 18);
    for ($i = 19; $i <= 99; $i ++)
    {
        array_push($ageArray, $i);
    }
    
    $this->setWidget('sex', new sfWidgetFormChoice(array(
       'multiple' => false,
       'choices' => array('M' => 'Male', 'F' => 'Female', 'T' => 'Transexual'),
       'default' => array('M', 0)
       )));
    $this->setWidget('nationality', new sfWidgetFormSelect(array('choices' => $countries)));
    $this->setWidget('age', new sfWidgetFormSelect(array('choices' => $ageArray)));
    //$this->setWidget('username', new sfWidgetFormInputText());
    
    $this->validatorSchema['sex'] = new sfValidatorChoice(array('choices' => array_keys(Doctrine_Core::getTable('GofishPlayer')->getSexTypes())));
    
    //not working, want to assign a value to sf_guard_user_id
    /*$this->vaiidatorSchema['sf_guard_user_id'] = new sfValidatorAnd(array(
            $this->validatorSchema['sf_guard_user_id'],
            new sfValidatorDoctrineChoice(
            array( 'model' => 'sfGuardUser',
                   'column' => 'id',
                   'throw_global_error' => true),
            array( 'invalid' => 'logic error' )
          )));*/

  }

}
